
function weigths = learn( Vb, w, game )

   ETA=0.1;                        % learning rate
   
   for b=1:game.movements
        board=game.boards{game.movements-b+1};
        if(b==1)
            vTrain=Vb;
        else
            vTrain=vSucesor;
        end
        
        vHatp=vHat(board,w);
        vSucesor=vHatp;
        
        w(1)=w(1)+ETA*(vTrain-vHatp)*x1(board);
        w(2)=w(2)+ETA*(vTrain-vHatp)*x2(board);
        w(3)=w(3)+ETA*(vTrain-vHatp)*x3(board);
        w(4)=w(4)+ETA*(vTrain-vHatp)*x4(board);
        w(5)=w(5)+ETA*(vTrain-vHatp)*x5(board);
        % normalizo los pesos
        w= w/sum(w);
        
   end
   weigths=w; % new weigths
end